<%--
  Created by IntelliJ IDEA.
  User: Lenovo
  Date: 2019/1/15
  Time: 21:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>添加收支信息</title>
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layui-v2.4.5/layui/css/modules/layer/default/layer.css" media="all">

</head>

<script src="/layuiadmin/layui/layui.js"></script>
<script src="/layuiadmin/layui/lay/modules/layer.js"></script>
<body>

<form class="layui-form" action="" style="margin-top: 30px">
    <div class="layui-form-item" style="margin-left: 20px">
        <div class="layui-inline">
            <label class="layui-form-label">名称</label>
            <div class="layui-input-block" style="width: 200px">
                <input type="text" name="name" required  lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item" style="margin-left: 20px">
        <div class="layui-inline">
            <label class="layui-form-label">类型</label>
            <div class="layui-input-block">
                <select name="type" lay-filter="aihao">
                    <option></option>
                    <option>收入</option>
                    <option>支出</option>
                </select>
            </div>
        </div>
    </div>
    <div class="layui-form-item layui-form-text" style="margin-left: 20px">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block" style="width: 300px">
            <textarea name="remark" placeholder="请输入内容" class="layui-textarea"></textarea>
        </div>
    </div>

    <div class="layui-form-item" style="margin-left: 100px">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>

</form>

<script>
    //Demo
    layui.use(['form','jquery'], function(){
        var form = layui.form,
                $=layui.jquery;

        //监听提交
        form.on('submit(formDemo)', function(data){
            layer.msg(JSON.stringify(data.field));
            console.log(JSON.stringify(data.field));

            $.post(
                    "/Inout/insertInout",
                    data.field,
                function(){
                    layer.msg("添加成功！");
                }
            )

            return false;
        });
    });
</script>
</body>
</html>
